package com.xu.seal.utils;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class ImageGenerator {
    public static void main(String[] args) {
        try {
            // 创建一个宽度为 100，高度为 100 的纯色图片
            BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);

            // 设置图片为纯红色
            Graphics2D g2d = image.createGraphics();
            g2d.setColor(Color.RED);
            g2d.fillRect(0, 0, 100, 100);
            g2d.dispose();

            // 保存图片到当前目录下的 "generated_image.png"
            File outputFile = new File("generated_image.png");
            ImageIO.write(image, "PNG", outputFile);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}